home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / findheader.c < prev    next >
C/C++ Source or Header  |  1993-01-29  |  761b  |  39 lines

  1. /*  $Revision: 1.7 $
  2. **
  3. */
  4. #include <stdio.h>
  5. #include <ctype.h>
  6. #include <sys/types.h>
  7. #include "configdata.h"
  8. #include "libinn.h"
  9. #include "clibrary.h"
  10. #include "macros.h"
  11.  
  12.  
  13. /*
  14. **  Find a header in an article.
  15. */
  16. char *
  17. HeaderFind(Article, Header, size)
  18.     char        *Article;
  19.     char        *Header;
  20.     register int    size;
  21. {
  22.     register char    *p;
  23.  
  24.     for (p = Article; ; ) {
  25.     /* Match first character, then colon, then whitespace (don't
  26.      * delete that line -- meet the RFC!) then compare the rest
  27.      * of the word. */
  28.     if (p[size] == ':'
  29.      && ISWHITE(p[size + 1])
  30.      && caseEQn(p, Header, (SIZE_T)size)) {
  31.         for (p += size; *++p != '\n' && ISWHITE(*p); )
  32.         continue;
  33.         return p;
  34.     }
  35.     if ((p = strchr(p, '\n')) == NULL || *++p == '\n')
  36.         return NULL;
  37.     }
  38. }
  39.